home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 03 - 1987 / 03.05 May 87 / big screens / Code Fragments
Encoding:
Text File  |  1986-09-15  |  2.2 KB  |  84 lines  |  [TEXT/MACA]

  1.  
  2. ; GetScreenSize.ASM
  3. ; This module finds out the size of the screen currently installed
  4. ; on your Mac
  5. ; It fills in a VAR rectangle with the coordinates of ;screenbits.bounds
  6.  
  7. INCLUDE        QuickEqu.D
  8.  
  9. XDEF        GetScreenSize
  10. ; Procedure    GetScreenSize(VAR r:rect)
  11.  
  12. GetScreenSize
  13.  
  14. r             SET    8        ;offset to rectangle parameter
  15. parambytes    SET    4            ; bytes for parameter
  16.     
  17.     
  18.     LINK        A6,#0            ; no locals 
  19.     MOVE.L        r(A6),A1        ; get dest rect
  20.     MOVE.L        GrafGlobals(A5),A0    ; get QD globals
  21.     LEA        screenBits+bounds(A0),A0    
  22.     
  23.     MOVE.L        (A0)+,(A1)+        ; move the first part
  24.     MOVE.L        (A0)+,(A1)+        ; move the rest
  25.     
  26.     UNLK        A6            ; get rid of stack frame
  27.     MOVE.L        (SP)+,A0        ; return address
  28.     ADDA.W        #parambytes,SP    ; strip parameter
  29.     JMP        (A0)            ; return
  30.     
  31. ;--------------------------- DoDrag --------------------------------------
  32. DoDrag
  33. ; The click was in the drag bar of the window.  Drag it.
  34.  
  35. ; xProcedure    GetScreenSize(VAR r:Rect)
  36.     PEA        tRect(A5)        ; global scratch rect
  37.     JSR        GetScreenSize
  38.     
  39. ;Procedure     InsetRect(VAR r:Rect;dh,dv:INTEGER)
  40.     PEA        tRect(A5)        ; the rect
  41.     MOVE.W        #20,-(SP)        ; dh
  42.     MOVE.W        #20,-(SP)        ; dv
  43.     _InsetRect
  44.  
  45. ; DragWindow (theWindow:WindowPtr; startPt: Point;             boundsRect: Rect);
  46.     MOVE.L        WWindow(A5),-(SP)    ; Pass window 
  47.     MOVE.L        Point(A5),-(SP)    ; mouse coordinates
  48.     PEA        tRect(A5)        ; and boundaries
  49.     _DragWindow                ; Drag Window
  50.     
  51.     BRA         NextEvent        ; Go get next event
  52.  
  53.  
  54.  
  55.  
  56. ;---------------------------- DoGrow -------------------------------------
  57. DoGrow
  58.  
  59. ; first include the scroll bar and grow region in update region
  60.     BSR        InvalidScroll
  61.     
  62. ; here is where we actually grow the window
  63. ; xProcedure    GetScreenSize(VAR r:Rect)
  64.     PEA        tRect(A5)            ; global scratch rect
  65.     JSR        GetScreenSize
  66.     
  67.     ADD.W        #70,tRect+top(A5)        ; 70 pixels high
  68.     ADD.W        #70,tRect+left(A5)        ; 70 pixels wide
  69.     SUB.W        #15,tRect+bottom(A5)    ; not too tall
  70.     MOVE.W        #$7FFF,tRect+right(A5)    ; extra-wide OK
  71.     
  72. ;FUNCTION GrowWindow(theWindow:WindowPtr;startPt:Point;
  73. ;               sizeRect:Rect):LONGINT
  74.     CLR.L        -(SP)                ; space for result
  75.     MOVE.L        WWindow(A5),-(SP)        ; theWindow
  76.     MOVE.L        Point(A5),-(SP)        ; startPt
  77.     PEA        tRect(A5)            ; sizeRect
  78.     _GrowWindow
  79.     MOVE.W        (SP)+,D1        ; new vertical dimension
  80.     MOVE.W        (SP)+,D0        ; new horizontal dimension
  81.     
  82. ; now draw it to the new size
  83.  
  84.